<template>
  <van-swipe :autoplay="3000" lazy-render>
  <van-swipe-item v-for="item in getBannerData" :key="item.id">
    <img :src="item.url_text" />
  </van-swipe-item>
</van-swipe>
</template>

<style>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>

<script setup>
import { ref,onMounted } from "vue";
// 导入 Vue Router 的钩子函数，用于获取路由实例
import { useRouter } from 'vue-router';
import { POST } from '@/services/request.js'; // 导入封装好的请求工具
// 获取路由实例，用于后续页面跳转
const router = useRouter();

const getBannerData= ref([]);

onMounted(async()=>{
  await getBanner();
})
const getBanner=async()=>{
  const bannerRes = await POST({
    url: '/Index/getBanner',
    // params: data.value,
  })
  if(bannerRes.code===1){
    // console.log(bannerRes.data.banner);
    getBannerData.value=bannerRes.data.banner;
    // console.log(getBannerData.value);
    // console.log(bannerRes.data);
    // getBannerData.value=bannerRes['url_text'];
    // console.log(getBannerData.value+'11111111111');
  }
}











</script>